//
//  ViewController.m
//  block
//
//  Created by honeyrr on 2017/12/20.
//  Copyright © 2017年 honeyrr. All rights reserved.
//

#import "ViewController.h"
#import "Dog.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //实例化一个对象
    Dog *dog = [Dog new];
    
    // 1. block作为对象属性
    void(^block_MBXB)(void) = ^() {
        NSLog(@"hello，dog eat shit");
    };
    dog.block = block_MBXB;
    dog.block();
    
    // 2.block作为方法的参数
    [dog eat:^(NSString *food) {
        NSLog(@"food:%@",food);
    }];
    
    // 3.block作为返回值
    dog.age(@200);
    dog.age(@10);
    // 扩展提升
    dog.zoos(@[@"1",@"2",@"3",@"100",@[@"1",@"2"]]);
}

@end
